import java.util.Scanner;

public class DdigitSquare {
    public static void main(String[] args) {
        int n,sum;
        sum = -1;
        Scanner input = new Scanner(System.in);
        n=input.nextInt();
        for (int i = n; i >= 0 ; i--) {
            for (int j = n; j >= 0 ; j--) {
                for (int k = n; k >= 0 ; k--) {
                    if((i + j) % 2 == 0 && (j + k) % 3 ==0 && (i + j + k) % 5 == 0 && (i + j + k) > sum)
                        sum = i + j +k;
                }
            }
        }
        System.out.println(sum);
    }
}
